package com.cswangdao.mapper;

import com.cswangdao.domain.dto.OrderListDTO;
import com.cswangdao.domain.dto.RefundDTO;
import com.cswangdao.domain.model.MarketOrder;
import com.cswangdao.domain.po.Order;
import com.cswangdao.domain.vo.WXOrderListVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

@Mapper
public interface MarketOrderMapper {


    /**
     * @description: 分页查询订单信息
     * @param: order
     * @return: Page<Order>
     */
    Page<Order> pageQueryInfo(OrderListDTO order);

    /**
     * @description: 根据Id查询订单信息
     * @param: orderId
     * @return: Order
     */
    Order getById(@Param("orderId") int orderId);

    /**
     * @description: 删除订单信息
     * @param: orderId
     * @return:  void
     */
    @Delete("delete from market_order where id = #{orderId} ")
    void deleteById(@Param("orderId") int orderId);

    /**
     * @description: 修该订单状态
     * @param: order
     * @return: void
     */
    void modifyOrderById(Order order);

    /**
     * @description: 将订单修改为已发货状态
     * @param: refundDTO
     * @return: void
     */
    void modifyOrderRedund(RefundDTO refundDTO);

    void addOrderInfo(MarketOrder order);

    Page<WXOrderListVo> queryOrderByUserIdAndStatus(Map<String, Object> map);

    Integer getOrdersByStatusAndUserId(@Param("userId") Integer userId, @Param("status") int status);
}